﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;

namespace MedReg.Classes
{
    [Serializable]
    public class Employee : ISerializable
    {
        private System.Guid idField;

        private decimal populationField;

        private string tabelNumberField;

        private LPU uzField;

        private System.DateTime changeTimeField;

        private Territory regionField;

        private string nameField;

        private string surnameField;

        private string patronameField;

        private SexEnum sexField;

        private System.DateTime birthdateField;

        private System.Nullable<System.DateTime> deathdateField;

        private DocumentEntity documentField;

        private string sNILSField;

        private string iNNField;

        private AddressEntity[] addressesField;

        private string phoneField;

        private Marriage marriageStateField;

        private Citizenship citezenshipStateField;

        private System.Nullable<bool> isRealPersonField;

        private System.Nullable<bool> hasAutoField;

        private System.Nullable<bool> hasChildrenField;

        private Award[] employeeAwardsField;

        private CardRecord[] employeeRecordsField;

        private DiplomaEducation[] employeeSpecialitiesField;

        private PostGraduateEducation[] employeePostGraduateEducationField;

        private SertificateEducation[] employeeSertificateEducationField;

        private SkillImprovement[] employeeSkillImprovementField;

        private Retrainment[] employeeRetrainmentField;

        private Qualification[] employeeQualificationField;

        private static readonly Employee theOneObject = new Employee();

        public static Employee GetEmployee()
        {
            return theOneObject;
        }

        /// <remarks/>
        public System.Guid ID
        {
            get
            {
                return this.idField;
            }
            set
            {
                this.idField = value;
            }
        }

        /// <remarks/>
        public decimal Population
        {
            get
            {
                return this.populationField;
            }
            set
            {
                this.populationField = value;
            }
        }

        /// <remarks/>
        public string TabelNumber
        {
            get
            {
                return this.tabelNumberField;
            }
            set
            {
                this.tabelNumberField = value;
            }
        }

        /// <remarks/>
        public LPU UZ
        {
            get
            {
                return this.uzField;
            }
            set
            {
                this.uzField = value;
            }
        }

        /// <remarks/>
        public System.DateTime ChangeTime
        {
            get
            {
                return this.changeTimeField;
            }
            set
            {
                this.changeTimeField = value;
            }
        }

        /// <remarks/>
        public Territory Region
        {
            get
            {
                return this.regionField;
            }
            set
            {
                this.regionField = value;
            }
        }

        /// <remarks/>
        public string Name
        {
            get
            {
                return this.nameField;
            }
            set
            {
                this.nameField = value;
            }
        }

        /// <remarks/>
        public string Surname
        {
            get
            {
                return this.surnameField;
            }
            set
            {
                this.surnameField = value;
            }
        }

        /// <remarks/>
        public string Patroname
        {
            get
            {
                return this.patronameField;
            }
            set
            {
                this.patronameField = value;
            }
        }

        /// <remarks/>
        public SexEnum Sex
        {
            get
            {
                return this.sexField;
            }
            set
            {
                this.sexField = value;
            }
        }

        /// <remarks/>
        //[System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
        public System.DateTime Birthdate
        {
            get
            {
                return this.birthdateField;
            }
            set
            {
                this.birthdateField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
        public System.Nullable<System.DateTime> Deathdate
        {
            get
            {
                return this.deathdateField;
            }
            set
            {
                this.deathdateField = value;
            }
        }

        /// <remarks/>
        public DocumentEntity Document
        {
            get
            {
                return this.documentField;
            }
            set
            {
                this.documentField = value;
            }
        }

        /// <remarks/>
        public string SNILS
        {
            get
            {
                return this.sNILSField;
            }
            set
            {
                this.sNILSField = value;
            }
        }

        /// <remarks/>
        public string INN
        {
            get
            {
                return this.iNNField;
            }
            set
            {
                this.iNNField = value;
            }
        }

        /// <remarks/>
        public AddressEntity[] Addresses
        {
            get
            {
                return this.addressesField;
            }
            set
            {
                this.addressesField = value;
            }
        }

        /// <remarks/>
        public string Phone
        {
            get
            {
                return this.phoneField;
            }
            set
            {
                this.phoneField = value;
            }
        }

        /// <remarks/>
        public Marriage MarriageState
        {
            get
            {
                return this.marriageStateField;
            }
            set
            {
                this.marriageStateField = value;
            }
        }

        /// <remarks/>
        public Citizenship CitezenshipState
        {
            get
            {
                return this.citezenshipStateField;
            }
            set
            {
                this.citezenshipStateField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
        public System.Nullable<bool> IsRealPerson
        {
            get
            {
                return this.isRealPersonField;
            }
            set
            {
                this.isRealPersonField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
        public System.Nullable<bool> HasAuto
        {
            get
            {
                return this.hasAutoField;
            }
            set
            {
                this.hasAutoField = value;
            }
        }

        /// <remarks/>
        [System.Xml.Serialization.XmlElementAttribute(IsNullable = true)]
        public System.Nullable<bool> HasChildren
        {
            get
            {
                return this.hasChildrenField;
            }
            set
            {
                this.hasChildrenField = value;
            }
        }

        /// <remarks/>
        public Award[] EmployeeAwards
        {
            get
            {
                return this.employeeAwardsField;
            }
            set
            {
                this.employeeAwardsField = value;
            }
        }

        /// <remarks/>
        public CardRecord[] EmployeeRecords
        {
            get
            {
                return this.employeeRecordsField;
            }
            set
            {
                this.employeeRecordsField = value;
            }
        }

        /// <remarks/>
        public DiplomaEducation[] EmployeeSpecialities
        {
            get
            {
                return this.employeeSpecialitiesField;
            }
            set
            {
                this.employeeSpecialitiesField = value;
            }
        }

        /// <remarks/>
        public PostGraduateEducation[] EmployeePostGraduateEducation
        {
            get
            {
                return this.employeePostGraduateEducationField;
            }
            set
            {
                this.employeePostGraduateEducationField = value;
            }
        }

        /// <remarks/>
        public SertificateEducation[] EmployeeSertificateEducation
        {
            get
            {
                return this.employeeSertificateEducationField;
            }
            set
            {
                this.employeeSertificateEducationField = value;
            }
        }

        /// <remarks/>
        public SkillImprovement[] EmployeeSkillImprovement
        {
            get
            {
                return this.employeeSkillImprovementField;
            }
            set
            {
                this.employeeSkillImprovementField = value;
            }
        }

        /// <remarks/>
        public Retrainment[] EmployeeRetrainment
        {
            get
            {
                return this.employeeRetrainmentField;
            }
            set
            {
                this.employeeRetrainmentField = value;
            }
        }

        /// <remarks/>
        public Qualification[] EmployeeQualification
        {
            get
            {
                return this.employeeQualificationField;
            }
            set
            {
                this.employeeQualificationField = value;
            }
        }
        
        [SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            //throw new NotImplementedException();
            info.AddValue("ID", idField);
            info.AddValue("Population", populationField);
            info.AddValue("TabelNumber", tabelNumberField);
            info.AddValue("UZ", uzField);
            info.AddValue("ChangeTime", changeTimeField);
            info.AddValue("Region", regionField);
            info.AddValue("Name", nameField);
            info.AddValue("Surname", surnameField);
            info.AddValue("Patroname", patronameField);
            info.AddValue("Sex", sexField);
            info.AddValue("Birthdate", birthdateField);
            info.AddValue("Deathdate", deathdateField);
            info.AddValue("Document", documentField);
            info.AddValue("INN", iNNField);
            info.AddValue("SNILS", sNILSField);
            info.AddValue("Addresses", addressesField);
            info.AddValue("Phone", phoneField);
            info.AddValue("MarriageState", marriageStateField);
            info.AddValue("CitezenshipState", citezenshipStateField);
            info.AddValue("IsRealPerson", isRealPersonField);
            info.AddValue("HasAuto", hasAutoField);
            info.AddValue("HasChildren", hasChildrenField);
            info.AddValue("EmployeeAwards", employeeAwardsField);
            info.AddValue("EmployeeRecords", employeeRecordsField);
            info.AddValue("EmployeeSpecialities", employeeSpecialitiesField);
            info.AddValue("EmployeePostGraduateEducation", employeePostGraduateEducationField);
            info.AddValue("EmployeeSertificateEducation", employeeSertificateEducationField);
            info.AddValue("EmployeeSkillImprovement", employeeSkillImprovementField);
            info.AddValue("EmployeeRetrainment", employeeRetrainmentField);
            info.AddValue("EmployeeQualification", employeeQualificationField);
            
        }
        public Employee()
        {
        }

    }
}
